package listener;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;

@WebListener
public class ContextListener implements ServletContextListener{


    @Override
    public void contextInitialized(ServletContextEvent sce) {
        //web工程启动(tomcat启动)执行一次
        System.out.println("创建servletContext");
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        //web工程关闭的时候执行一次
        System.out.println("销毁servletContext");
    }
}
